#include #include #include #include #define UA "Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04)" int main (int argc, char ** argv) { if (argc < 1+1) { fprintf(stderr, "%s \n", argv[0]); return 1; } char * contentType = NULL; char * redir = NULL; int readstatus = 0; char buf[4096]; /* xmlNanoHTTPInit(); */ void * r = xmlNanoHTTPMethodRedir(argv[1], "GET", NULL /* inp */, &contentType, &redir, "User-Agent: " UA "\r\n", 0 /* inplen */); if (!r) { fprintf(stderr, "!r\n"); return 1; } if (xmlNanoHTTPReturnCode(r) != 200) fprintf(stderr, "xmlNanoHTTPReturnCode(r) != 200\n"); while ((readstatus = xmlNanoHTTPRead(r, buf, 4096)) > 1) write(1, buf, readstatus); if (readstatus == -1) fprintf(stderr, "readstatus == -1\n"); xmlNanoHTTPClose(r); free(contentType); free(redir); /* xmlNanoHTTPCleanup(); */ return 0; }